package com.kanshu.basictest.ui.activity.view;

import android.util.Log;
import android.view.View;
import android.widget.AdapterView;

import com.kanshu.basictest.R;
import com.kanshu.basictest.model.menu.MenuItem;
import com.kanshu.basictest.ui.base.BaseListMenuActivity;

import java.util.ArrayList;
import java.util.List;

public class ViewMethodTestActivity extends BaseListMenuActivity {

    @Override
    protected String provideBarTitle() {
        return "View相关的方法";
    }

    public static final String TAG = "ViewMethodTestActivity";


    @Override
    protected List<? extends MenuItem> provideMenuData() {
        List<MenuItem> menuItems = new ArrayList<>();
        menuItems.add(0, new MenuItem("获取 DecorView", R.color.brown_300));
        return menuItems;
    }

    @Override
    protected void init() {
        super.init();
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
        switch (position) {
            case 0://View相关的方法
                getDecorViewByActivity();
                break;
            default:
                break;

        }

    }


    private void getDecorViewByActivity() {
        View decorView = getWindow().getDecorView();
        Log.i(TAG, "getDecorViewByActivity: decorView:" + decorView);//com.android.internal.policy.impl.PhoneWindow$DecorView{19e52325 V.E..... R....... 0,0-1280,768}
        Log.i(TAG, "getDecorViewByActivity: decorView.getClass():" + decorView.getClass());//class com.android.internal.policy.impl.PhoneWindow$DecorView
        Log.i(TAG, "getDecorViewByActivity: decorView.getClass().getSuperclass:" + decorView.getClass().getSuperclass());//class android.widget.FrameLayout
    }


}
